home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / raytrace / renaisnc / lib.lha / Lib / mesh.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-04  |  1.3 KB  |  81 lines

  1. /* File: mesh.h
  2. ** Author: Charles Loop
  3. ** Purpose: Defines data structures and constants needed to make a mesh.
  4. ** Last Modified: 2 July, 1987
  5. ** Reason : Creation.
  6. */
  7.  
  8. /* Topology Types */
  9. #define MESH      1
  10. #define FACE      2
  11. #define SUBMESH   3
  12. #define TRIANGLE  4
  13. #define EDGE      5
  14. #define POINT     6
  15.  
  16. /* Maximum Vertex order */
  17. #define maxN 16
  18.  
  19. /* Other constants */
  20. #define TwoPi  6.28318530717958647692
  21. #define MIN    0
  22. #define MAX    1
  23.  
  24. /* Mesh data structures */
  25.  
  26. typedef struct Vertex {
  27.   double x,y,z,a,b,c,k;
  28. } Vertex;
  29.  
  30. typedef struct Plane {
  31.   double a,b,c,d;
  32.   short maxcomponent;
  33. } Plane;
  34.  
  35. typedef struct Edge {
  36.   PointType4D *p;
  37.   struct Edge *e, *next;
  38. } Edge;
  39.  
  40. typedef struct Triangle {
  41.   Vertex *V[3];
  42.   Plane *pl;
  43. } Triangle;
  44.  
  45. typedef struct Mesh {
  46.   short type;
  47.   double box[3][2];
  48.   double r;
  49.   union {
  50.     struct Mesh *m;
  51.     Edge *e;
  52.     Triangle *t;
  53.   } sub;
  54.   struct Mesh *next;
  55. } Mesh;
  56.  
  57. /* Symbol Table data structures */
  58.  
  59. typedef union Datum {
  60.   double val;
  61.   PointType4D *p;
  62.   Edge *e;
  63.   Mesh *m;
  64. } Datum;
  65.  
  66. typedef struct SymbolEntry {
  67.   char *name;
  68.   Datum    u;
  69.   struct SymbolEntry   *next;
  70.   short type;   /* POINT, FACE, MESH */
  71. } SymbolEntry;
  72.  
  73. /* Edge Table data structures */
  74.  
  75. typedef struct EdgeEntry {
  76.   PointType4D *p,*q;
  77.   Edge *e;
  78.   struct EdgeEntry *next;
  79. } EdgeEntry;
  80.  
  81.